from sklearn.model_selection import cross_val_score
from sklearn.linear_model import LogisticRegression
import numpy as np

# 创建数据
X = np.array([[1, 2], [2, 3], [3, 4], [4, 5]])
y = np.array([0, 0, 1, 1])

# 训练模型
model = LogisticRegression()
scores = cross_val_score(model, X, y, cv=2)

print("Cross-validation scores:", scores)